package ALT.entities;

import java.util.ArrayList;
import java.util.List;

public class Member {

    private static int COUNTER = 0;
    private String mOID;
    private String mNickname;
    private String mPassword;
    private String mEmail;
    private int mPoints;
    private List<Forum> subscriptions;

    public Member(String nickname, String password, String email) {
        this.mOID = String.valueOf(COUNTER++);
        this.mNickname = nickname;
        this.mPassword = password;
        this.mEmail = email;
        this.mPoints = 0;
        this.subscriptions = new ArrayList<Forum>();
    }

    public void addSubscription(Forum f) {
        subscriptions.add(f);
    }

    public void removeSubscription(Forum f) {
        subscriptions.remove(f);
    }

    /**
     * @return the mOID
     */
    public String getmOID() {
        return mOID;
    }

    /**
     * @return the mNickname
     */
    public String getmNickname() {
        return mNickname;
    }

    /**
     * @param mNickname the mNickname to set
     */
    public void setmNickname(String mNickname) {
        this.mNickname = mNickname;
    }

    /**
     * @return the mPassword
     */
    public String getmPassword() {
        return mPassword;
    }

    /**
     * @param mPassword the mPassword to set
     */
    public void setmPassword(String mPassword) {
        this.mPassword = mPassword;
    }

    /**
     * @return the mEmail
     */
    public String getmEmail() {
        return mEmail;
    }

    /**
     * @param mEmail the mEmail to set
     */
    public void setmEmail(String mEmail) {
        this.mEmail = mEmail;
    }

    /**
     * @return the mPoints
     */
    public int getmPoints() {
        return mPoints;
    }

    /**
     * @param mPoints the mPoints to set
     */
    public void setmPoints(int mPoints) {
        this.mPoints = mPoints;
    }

    /**
     * @return the subscriptions
     */
    public List<Forum> getSubscriptions() {
        return subscriptions;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + (this.mOID != null ? this.mOID.hashCode() : 0);
        hash = 23 * hash + (this.mNickname != null ? this.mNickname.hashCode() : 0);
        hash = 23 * hash + (this.mPassword != null ? this.mPassword.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Member other = (Member) obj;
        if ((this.mOID == null) ? (other.mOID != null) : !this.mOID.equals(other.mOID)) {
            return false;
        }
        if ((this.mNickname == null) ? (other.mNickname != null) : !this.mNickname.equals(other.mNickname)) {
            return false;
        }
        if ((this.mPassword == null) ? (other.mPassword != null) : !this.mPassword.equals(other.mPassword)) {
            return false;
        }
        return true;
    }

    

    @Override
    public String toString() {
        return "Member{" + "mOID=" + mOID + ", mNickname=" + mNickname + '}';
    }
    
    
}
